Azure Bot Service
- Part 9 (Debugging your bot)為了開發邏輯更為複雜的 bot,利用本機開發是必然的,只是因為 Azure Bot Services
有包裝過所以開發上的設定有些小細節需要特別注意,克服這些問題就可以進入快速開發以及除錯了
以
C#
為例,以下軟體皆會使用到,其中 Visual Studio 2017 RC 可以使用Visual Studio 2015
代替
Microsoft Bot Framework Emulator
bot endpoint url
Azure bot service 下載回來的專案中所提供,預設為
http://localhost:3978/api/messages
Microsoft App ID
bot framework 的 app id
Microsoft App Password
bot framework 的 password
使用 command prompt
csproj
至 project.json
所在位置 dotnet restore
-->取回相依參考debughost.cmd
時,無相關設定的提示訊息----------------------------------------------------------------------
To fetch your bot service settings run the following command:
func azure functionapp fetch-app-settings [YOUR_BOT_SERVICE_NAME]
----------------------------------------------------------------------
Function completed (Failure, Id=7*******************************6d)
ScriptHost error has occurred
xception while executing function: Functions.messages. Microsoft.Bot.Connector: Authorization for Microsoft App ID failed with status code Unauthorized.
使用 Visual Studio 2017 RC
2-1. 下載csproj
至 project.json
所在位置
2-2. Restore Nuget Packages
2-3. 取回 Azure Function 設定
func azure functionapp fetch-app-settings {YOUR_BOT_SERVICE_NAME}
執行
debughost.cmd
時,無相關設定的提示訊息
---------------------------------------------------------------------
o fetch your bot service settings run the following command:
func azure functionapp fetch-app-settings [YOUR_BOT_SERVICE_NAME]
---------------------------------------------------------------------
``
Function completed (Failure, Id=7*******************************6d)
A ScriptHost error has occurred
Exception while executing function: Functions.messages. Microsoft.Bot.Connector: Authorization for Microsoft App ID failed with status code Unauthorized.
![VSfetchsetting](https://trello-attachments.s3.amazonaws.com/5839ddfe731a78bc5eac486b/1200x358/b1b354852fcac90b0cc8e4c139b8de7f/_output_VSfetchsetting.png)
![VSfetchsettingERROR](https://trello-attachments.s3.amazonaws.com/5839ddfe731a78bc5eac486b/1033x351/7f9e9eacf6ccbdce3668174be9fefaa1/_output_VSfetchsettingERROR.png)
Microsoft Bot Framework Emulator
Log
區可以檢視回應,點選 log 可以在上方的 Details
區看到詳細內容command prompt
確認有收到以及正常執行
Visual Studio 2017 RC
Task Runner Explorer
執行服務
確認有收到以及正常執行
2-2. F5 直接逐步偵錯